//
//  AppInfoCell.swift
//  pgy
//
//  Created by vsccw on 2018/12/28.
//  Copyright © 2018 vsccw.com. All rights reserved.
//

import UIKit

import SDWebImage

class AppInfoCell: TableCell {
  
  @IBOutlet weak var iconImageView: UIImageView!
  @IBOutlet weak var titleLabel: UILabel!
  @IBOutlet weak var buildLabel: UILabel!
  
  var info: AppInfo? {
    didSet {
      guard let info = info else { return }
      let iconURLString = Application.Config.imagePrefix + info.appIcon
      iconImageView.sd_setImage(with: URL(string: iconURLString), completed: nil)
      titleLabel.text = info.appName
      buildLabel.text = "v" + info.appVersion + " b" + info.appVersionNo
    }
  }
  
  override func awakeFromNib() {
    super.awakeFromNib()
  }
  
  override func setSelected(_ selected: Bool, animated: Bool) {
    super.setSelected(selected, animated: animated)
  }
  
  override func prepareForReuse() {
    super.prepareForReuse()
    iconImageView.sd_cancelCurrentImageLoad()
  }
  
}
